// JavaScript Document
mpsprofile = jQuery.noConflict();

mpsprofile().ready(function() {
							
					
                    mpsprofile("#mpsprofile-node-form").validate({
						
						rules: {
							'field_mp_position[und]':{
							required:true,	
							},
							'field_mp_lok_designation[und][0][value]':{
							minlength:5,
							maxlength:255,
							badchar:true,
						   },
						   'field_mp_constituencey_name[und]':
						   {
							 required:true,
							 valuenotequals: '_none',
						   },
						   'title':{
						   required:true,
						   minlength: 5,
						   maxlength: 255,
						   badchar:true,
						   },
						   'field__mp_party[und]':{
							 required:true,
							 valuenotequals: '_none',
							 },
							'files[field_mp_photo_und_0]':{
							required:true,
							//checkfile_format_size: true,
							},
							'field_mp_addinfo[und][0][value]':
							{
							minlength: 5,
						   	maxlength: 255,
							badchar:true,
							},
							'field_mp_address[und][0][value]':{
							badchar:true,
							},
							'field_mp_add_delhi[und][0][value]':{
							badchar:true,
							},
							'field_mp_phone[und][0][value]':{
							digits:true,
							},
							'field_mp_local_phone2[und][0][value]':{
							digits:true,
							},
							'field_mp_phone_delhi[und][0][value]':{
							digits:true,
							},
							'field_mp_phone2_delhi[und][0][value]':{
							digits:true,
							},
							'field_mp_local_phone1_code[und][0][value]':
							{
							minlength:3,
							maxlength:5,
							digits:true,
							},
							'field_mp_local_phone2_code[und][0][value]':{
							minlength:3,
							maxlength:5,
							digits:true,
							},
							'field_mp_delhi_phone1[und][0][value]':{	
							minlength:3,
							maxlength:5,
							digits:true,
							},
							'field_mp_delhi_phone2_code[und][0][value]':{
								minlength:3,
								maxlength:5,
								digits:true,
							},
							'field_mp_fax_code[und][0][value]':{
								minlength:3,
								maxlength:5,
								digits:true,
							},
							'field_mp_fax[und][0][value]':
							{
							digits:true,
							},
							'field_mp_email[und][0][value]':{
							  email:true,
							},
							'field_mp_website[und][0][value]':{
							url:true,
							},
						},
						messages: {
							'field_mp_position[und]':{
							required:'Please Choose the position',	
							},
							'field_mp_lok_designation[und][0][value]':{
							minlength:'Minimum 5 characters should be entered',
							maxlength:'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
						   },
						   'field_mp_constituencey_name[und]':
						   {
							 required:'Please Select a constituency',  
							 valuenotequals: 'Please Select the Constituency Name',
						   },
						   'title':{
						   required:'Please Enter your name',
						   minlength: 'Minimum 5 characters should be entered',
						   maxlength: 'Maximum 255 character only allowed',
						   badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
						   },
						   'field__mp_party[und]':{
							 required:'Please Choose the party name',
							 valuenotequals: 'Please Choose the party name',
							 },
							'files[field_mp_photo_und_0]':{
							required:'Please Choose a photo',
							//checkfile_format_size: 'Invalid file format',
							},
							'field_mp_addinfo[und][0][value]':
							{
							minlength: 'Minimum 5 characters should be entered',
						   	maxlength: 'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
							},
							'field_mp_address[und][0][value]':{
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
							},
							'field_mp_add_delhi[und][0][value]':{
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
							},
							'field_mp_phone[und][0][value]':{
							digits:'Phone Number should be only digits',
							},
							'field_mp_local_phone2[und][0][value]':{
							digits:'Phone Number should be only digits',
							},
							'field_mp_phone_delhi[und][0][value]':{
							digits:'Phone Number should be only digits',
							},
							'field_mp_phone2_delhi[und][0][value]':{
							digits:'Phone Number should be only digits',
							},
							'field_mp_local_phone1_code[und][0][value]':
							{
							minlength:'Minimum 3 characters should be entered',
							maxlength:'Maximum 5 character only allowed',
							digits:'Code Number should be only digits',
							},
							'field_mp_local_phone2_code[und][0][value]':{
							minlength:'Minimum 3 characters should be entered',
							maxlength:'Maximum 5 character only allowed',
							digits:'Code Number should be only digits',
							},
							'field_mp_delhi_phone1[und][0][value]':{	
							minlength:'Minimum 3 characters should be entered',
							maxlength:'Maximum 5 character only allowed',
							digits:'Code Number should be only digits',
							},
							'field_mp_delhi_phone2_code[und][0][value]':{
							minlength:'Minimum 3 characters should be entered',
							maxlength:'Maximum 5 character only allowed',
							digits:'Code Number should be only digits',
							},
							'field_mp_fax_code[und][0][value]':{
							minlength:'Minimum 3 characters should be entered',
							maxlength:'Maximum 5 character only allowed',
							digits:'Code Number should be only digits',
							},
							'field_mp_fax[und][0][value]':
							{
							digits:'phone Number should be only digits',
							},
							'field_mp_email[und][0][value]':{
							email:'Invalid e-mail format',
							},
							'field_mp_website[und][0][value]':{
							url:'Invalid URL',
							},
						}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //acts("#actform-node-form").create_errormsg_container('errormsg_container','actform-node-form');
						}
							
							mpsprofile('html, body').animate({
								scrollTop: mpsprofile(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});
 

            
});
